import 'package:flutter/material.dart';
import 'res/ListData.dart';

void main() {
  runApp(MyApp());
}

//自定义组件
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // MaterialApp是根组件
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('First Web'),
        ),
        body: HomeContent(),
      ),
      theme: ThemeData(primaryColor: Colors.blue),
    );
  }
}

//自定义内容组件
class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Card(
          margin: EdgeInsets.all(10),
          child: Column(
            children: [
              AspectRatio(
                aspectRatio: 16 / 9,
                child: Image.asset(
                  "images/independentmind.jpeg",
                  fit: BoxFit.cover,
                ),
              ),
              ListTile(
                leading: CircleAvatar(
                  child: Image.asset(
                    "images/independentmind.jpeg",
                    fit: BoxFit.cover,
                    height: 60,
                    width: 60,
                  ),
                ),
                title: Text(
                  "标题",
                  style: TextStyle(fontSize: 28),
                ),
                subtitle: Text("描述内容"),
              ),
              ListTile(
                subtitle: Text("地址"),
              ),
            ],
          ),
        ),
        Card(
          margin: EdgeInsets.all(10),
          child: Column(
            children: [
              AspectRatio(
                aspectRatio: 16 / 9,
                child: Image.asset(
                  "images/independentmind.jpeg",
                  fit: BoxFit.cover,
                ),
              ),
              ListTile(
                leading: ClipOval(
                  child: Image.asset(
                    "images/independentmind.jpeg",
                    fit: BoxFit.cover,
                    height: 60,
                    width: 60,
                  ),
                ),
                title: Text(
                  "标题",
                  style: TextStyle(fontSize: 28),
                ),
                subtitle: Text("描述内容"),
              ),
              ListTile(
                subtitle: Text("地址"),
              ),
            ],
          ),
        ),
        Card(
          margin: EdgeInsets.all(10),
          child: Column(
            children: [
              AspectRatio(
                aspectRatio: 16 / 9,
                child: Image.asset(
                  "images/independentmind.jpeg",
                  fit: BoxFit.cover,
                ),
              ),
              ListTile(
                leading: ClipOval(
                  child: Image.asset(
                    "images/independentmind.jpeg",
                    fit: BoxFit.cover,
                    height: 60,
                    width: 60,
                  ),
                ),
                title: Text(
                  "标题",
                  style: TextStyle(fontSize: 28),
                ),
                subtitle: Text("描述内容"),
              ),
              ListTile(
                subtitle: Text("地址"),
              ),
            ],
          ),
        )
      ],
    );
  }
}
